﻿#ifndef __lvgl_radio_h__
#define __lvgl_radio_h__


#include "main.h"
#include "lvgl_project.h"

#if 1
#define lvgl_radio_debug(format, ...) lvgl_project_debug("[lvgl radio]-",format,##__VA_ARGS__);
#else
#define lvgl_radio_debug(format, ...) ;
#endif

#define radio_ICON_MAX 8
#define radio_GIF_SW 0
#define radio_PNG_BG 1

#define radio_GIF_PATH "P:/E:/gsm-fm/gsm-fm-simulator/LVGL.Simulator/lvgl_project/image/icon/black bg/gif/"

typedef struct
{
    lv_obj_t* cont;
    lv_obj_t* image;
    lv_obj_t* label1;
    lv_obj_t* label2;


}__lvgl_radio_p_data;



typedef struct
{
	char p_buf[100];

	lv_obj_t *cont_main;
	lv_obj_t *task;
	lv_anim_t anim_in;
	lv_anim_t anim_out;
	lv_anim_path_t anim_path_in;
	lv_anim_path_t anim_path_out;


	lv_anim_t anim_vol;
	lv_anim_path_t anim_path_vol;
	lv_obj_t *cont_vol;
	lv_obj_t *image_vol;
	lv_obj_t *bar_vol;
    int vol;
    int vol_align_x;
    int vol_align_y;


	lv_anim_t anim_sig;
	lv_anim_path_t anim_path_sig;
    lv_obj_t* cont_sig;
    lv_obj_t* image_sig;
    lv_obj_t* bar_sig;
    int set_sig;
    int sig_align_x;
    int sig_align_y;

    lv_obj_t* label_frequency;
	lv_anim_t anim_frequency;
	lv_anim_path_t anim_path_frequency;
    int frequency;
    int frequency_old;
    int onoff;

    int search_flag;
    uint8_t on_flag;


    lv_anim_t anim_select_x;
    lv_anim_path_t anim_path_select_x;
    lv_anim_t anim_select_y;
    lv_anim_path_t anim_path_select_y;
    lv_anim_t anim_select_w;
    lv_anim_path_t anim_path_select_w;
    lv_anim_t anim_select_h;
    lv_anim_path_t anim_path_select_h;
    lv_obj_t* cont_select;
    int16_t select_num;
    bool select_flag;
    uint16_t select_count;

    lv_obj_t *cont_p;
    lv_anim_t anim_p_pos;
    lv_anim_path_t anim_path_p_pos;
    lv_anim_t anim_p_size;
    lv_anim_path_t anim_path_p_size;
    int16_t p_num;
    bool p_flag;
    uint16_t p_count;
    bool p_save_flag;


    lv_obj_t* image_background;
    lv_anim_t anim_background;
    lv_anim_path_t anim_path_background;
    uint8_t backstage_flag;


    lv_obj_t* image_save;
    lv_anim_t anim_save;
    lv_anim_path_t anim_path_save;
    uint8_t save_flag;



    __lvgl_radio_p_data p[5];

    lv_obj_t* label_mhz;

    lv_obj_t* label1;
    lv_obj_t* image1;
    lv_obj_t* image2;
    lv_obj_t* image3;
    lv_obj_t* image4;
    lv_obj_t* image5;
    lv_obj_t* image6;
    lv_obj_t* image7;
    lv_obj_t* image8;



    lv_obj_t* btn1;
    lv_obj_t* img_gif1;
    lv_task_t* close_task;
    bool ctrl_close_flag;
    uint32_t close_count;
    uint8_t close_num;




}__lvgl_radio_data;

extern __lvgl_radio_data lvgl_radio_data;




void lvgl_radio_create(lv_obj_t * Fu);
void lvgl_radio_close(void);
void lvgl_radio_hidden(void);
void lvgl_radio_set_frequency(int data);
void lvgl_radio_open(void);
void lvgl_radio_detect_p(char *data);

#endif
